package com.quanyan.user.web;

import com.quanyan.api.APIResponse;
import com.quanyan.user.model.vo.response.RespCheckVersion;
import com.quanyan.user.service.UserInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by huadongyang on 2016/11/29.
 */
@RestController
@RequestMapping("/user/base")
public class AppVersionController {
    @Autowired
    private UserInformationService userInformationService;
    /**
     * 检查版本更新
     * @param map
     * @return
     */
    @RequestMapping(value = "checkVersion",method = RequestMethod.POST)
    public APIResponse<RespCheckVersion> checkVersion(@RequestBody Map map){
        int version = (int) map.get("version");
        int osType = (int) map.get("osType");
        Integer appType = (Integer) map.get("appType");
        RespCheckVersion respCheckVersion = this.userInformationService.checkVersion(version,osType, appType);
        return APIResponse.returnSuccess(respCheckVersion);
    }
}
